package com.gxa.controller;

import com.gxa.common.R;
import com.gxa.pojo.Receipt_Purchase;
import com.gxa.service.PurchaseService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Controller
@Api(value = "购货或退货",tags = "购货或退货接口API")
@RequestMapping("/purchase")
public class PurchaseController {
    @Autowired
    private PurchaseService purchaseService;

    @RequestMapping(value = "/addPurchase",method = RequestMethod.POST)
    @ApiOperation(value = "添加购货或退货单接口",notes = "添加购货或退货单", response = R.class)
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })

     public R addPurchase(@RequestBody @ApiParam(name = "receipt_Purchase",value = "添加购货或退货单单商品",required = true)Receipt_Purchase receipt_Purchase){
         return purchaseService.inerstReceiptPurchase(receipt_Purchase);

     }
    @RequestMapping(value = "/audit",method = RequestMethod.POST)
    @ApiOperation(value = "审核购货或退货单接口",notes = "审核购货或退货单", response = R.class)
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
     public  R  audit(@RequestBody@ApiParam Map map){

        return  purchaseService.auditReceiptPurchase(map);
     }




}
